typedef char BTDataType;

typedef struct BinaryTreeNode
{
	BTDataType _data;
	struct BinaryTreeNode* _left;
	struct BinaryTreeNode* _right;
}BTNode;

// 通过前序遍历的数组"ABD##E#H##CF##G##"构建二叉树
BTNode* BinaryTreeCreate(BTDataType* a, int n, int* pi)
{
    if(a == NULL)
    {
        printf("N\n");
        return 0;
    }
    printf("%d\n",a->data);
    BinaryTreeCreate(a->left);
    BinaryTreeCreate(a->right);
    
}
// 二叉树销毁
void BinaryTreeDestory(BTNode** root);
// 二叉树节点个数
int size=0;
int BinaryTreeSize(BTNode* root)
{
    if(root == NULL)
        return 0;
    else
        size++;
     BinaryTreeSize(root -> left);
    BinaryTreeSize(root->right);
    return size;
    
}

// 二叉树叶子节点个数
int BinaryTreeLeafSize(BTNode* root)
{
    if(root == NULL)
        return 0;
    if(root->left==NULL && root->right==NULL)
        return 1;
    return BinaryTreeLeafSize(root->left)+BinaryTreeLeafSize(root->right);
}
//求二叉树的高度
int TreeHight(BTNode* root)
{
    if(root == NULL)
        return 0;
    int leftHeight=TreeHight(root->left);
    int rightHeight=TreeHight(root->right);
    return leftHeight>rightHigh?leftHight+1:rightHight+1;
}
// 二叉树第k层节点个数
int BinaryTreeLevelKSize(BTNode* root, int k);
{
    if(root == NULL)
    {
        return 0;
    }
    
    if(k == 1)
        return 1;
    return BinaryTreeLevelKSize(root ->left,k-1)+BinaryTreeLevelKSize(root->right,k-1);
}
// 二叉树查找值为x的节点
BTNode* BinaryTreeFind(BTNode* root, BTDataType x)
{
    if(root->NULL)
        return 0;
    if(root->data==x)
        return root;
    BTNode* ret1 = BinaryTreeFind(root->left,x);
    if(ret1)
        return ret1;
    BTNode* ret2 = BinaryTreeFind(root->right,x);
    if(ret2)
        return ret2;
}